import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import VueRouter from 'unplugin-vue-router/vite'
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from '@vant/auto-import-resolver';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    VueRouter({
      // importMode: 'sync',
    }),
    AutoImport({
      include: [
        /\.[tj]sx?$/,
        /\.vue$/,
        /\.vue\?vue/,
      ],
      resolvers: [VantResolver(), ElementPlusResolver()],
    }),
    Components({
      extensions: ['vue'],
      resolvers: [VantResolver(), ElementPlusResolver()],
      include: [/\.vue$/, /\.vue\?vue/],
      dts: './components.d.ts',
    }),
  ],
})
